<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="h" uri="/WEB-INF/config/tag/feonix-tags.tld"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>功能权限管理</title>
<h:head pagetype="dialog" validity="true"></h:head>
<script>
	$(function() {
		$("#oprform").validity(function() {
			$("#name").require("角色名称不能为空").match('username1', "角色名称只能由字母、数字、下划线、中文组成").maxLength(33, "角色名称不能超过33个字");
			$("#spec").maxLength(85, "角色简介不能超过85个字");
		}, {
			success : function(result) {
				if (result.success) {
					closeDialog(true);
				} else {
					alert(result.message);
				}
			}
		});
	});
	
	/*
	 *	选择父级的功能
	 */
	function chooseParent(){
		openDialog('right/righttree_show' , 300, 550, {
			title : '角色权限设置',
			callback : setCallbackValue
		});
	}
	
	function setCallbackValue(node){
		$("#parentCodeId").val(node.attr.codeId);
		$("#moduleId").val(node.attr.moduleId);
		$("#moduleName").val(node.attr.moduleName);
		
	}
</script>
</head>
<body>
<body>
	<form action="${url }" method="post" id="oprform" name="oprform">
		<input type="hidden" name="iid" id="iid" value="${right.iid }" />
		<div id="dialog-content">
			<table border="0" align="center" class="table">
				<tr>
					<td align="right" class="label">功能编码</td>
					<td class="required">*</td>
					<td>
						<c:choose>
							<c:when test="${url=='modify_submit.do'}">
								<input type="text" id="codeId" name="codeId" class="input-text" value="${right.codeId }" readonly="readonly" />&nbsp;
							</c:when>
							<c:otherwise>
								<input type="text" id="codeId" name="codeId" class="input-text" value="${right.codeId  }" />&nbsp;
							</c:otherwise>
						</c:choose>
					</td>
				</tr>
				<tr>
					<td align="right" class="label">父级功能标识</td>
					<td>&nbsp;</td>
					<td>
						<input type="text" id="parentCodeId" name="parentCodeId" class="input-text" value="${right.parentCodeId}" />
						<input type="button" class="btn btn-primary" value="选择" onclick="chooseParent();" />
					</td>
				</tr>
				<tr>
					<td align="right" class="label">模块标识</td>
					<td class="required">*</td>
					<td>
						<input type="text" id="moduleId" name="moduleId" class="input-text" value="${right.moduleId}" />
					</td>
				</tr>
				<tr>
					<td align="right" class="label">模块名称</td>
					<td class="required">*</td>
					<td>
						<input type="text" id="moduleName" name="moduleName" class="input-text" value="${right.moduleName}" />
					</td>
				</tr>
				<tr>
					<td align="right" class="label">功能标识</td>
					<td>&nbsp;</td>
					<td>
						<input type="text" id="functionId" name="functionId" class="input-text" value="${right.functionId}" />
					</td>
				</tr>
				<tr>
					<td align="right" class="label">功能名称</td>
					<td>&nbsp;</td>
					<td>
						<input type="text" id="functionName" name="functionName" class="input-text" value="${right.functionName}" />
					</td>
				</tr>
				<tr>
					<td align="right" class="label">动态标识</td>
					<td>&nbsp;</td>
					<td>
						<input type="text" id="dynamicId" name="dynamicId" class="input-text" value="${right.dynamicId}" />
					</td>
				</tr>
			</table>
		</div>
		<div id="dialog-toolbar">
			<div id="dialog-toolbar-panel">
				<input type="submit" class="btn btn-primary" value="保存" />
				<input type="button" class="btn" value="取消" onclick="closeDialog();" />
			</div>
		</div>
	</form>
</body>
</html>